﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class resetpwd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string c = Server.UrlDecode(Request.Params["code"]);
        string sql = "select * from Users where TempCode='"+Fun.L(c)+"'";
        DataTable dt = Fun.CreateDt(sql);
        if (dt.Rows.Count < 1)
        {
            Response.Write("重置密码失败，请联系管理员查找密码");
        }
        else
        {
            LwUser u = new LwUser(Convert.ToInt32(dt.Rows[0]["Guid"]));
            u.Password = u.UserID;
            u.TempCode = "";
            u.Update();
            Fun.Redirect(Params.RootHttp + "default.aspx", "已重置密码为用户名，请重新登录");
            //Response.Write("");
        }
        //Response.End();
    }
}
